/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.going.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Olguita
 */
@Entity
@Table(name = "nota")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Nota.findAll", query = "SELECT n FROM Nota n"),
    @NamedQuery(name = "Nota.findByCodNota", query = "SELECT n FROM Nota n WHERE n.codNota = :codNota"),
    @NamedQuery(name = "Nota.findByFecha", query = "SELECT n FROM Nota n WHERE n.fecha = :fecha"),
    @NamedQuery(name = "Nota.findByNotas", query = "SELECT n FROM Nota n WHERE n.notas = :notas")})
public class Nota implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_nota")
    private Integer codNota;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "notas")
    private String notas;
    @JoinColumn(name = "cod_cliente_nota", referencedColumnName = "cedula")
    @ManyToOne(optional = false)
    private Cliente codClienteNota;

    public Nota() {
    }

    public Nota(Integer codNota) {
        this.codNota = codNota;
    }

    public Nota(Integer codNota, Date fecha, String notas) {
        this.codNota = codNota;
        this.fecha = fecha;
        this.notas = notas;
    }

    public Integer getCodNota() {
        return codNota;
    }

    public void setCodNota(Integer codNota) {
        this.codNota = codNota;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getNotas() {
        return notas;
    }

    public void setNotas(String notas) {
        this.notas = notas;
    }

    public Cliente getCodClienteNota() {
        return codClienteNota;
    }

    public void setCodClienteNota(Cliente codClienteNota) {
        this.codClienteNota = codClienteNota;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codNota != null ? codNota.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nota)) {
            return false;
        }
        Nota other = (Nota) object;
        if ((this.codNota == null && other.codNota != null) || (this.codNota != null && !this.codNota.equals(other.codNota))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.com.going.modelo.Nota[ codNota=" + codNota + " ]";
    }
    
}
